import org.teasoft.bee.osql.BeeException;
import org.teasoft.honey.osql.autogen.GenBean;
import org.teasoft.honey.osql.autogen.GenConfig;
import org.teasoft.honey.osql.core.HoneyConfig;

public class GenBeanExam {


	public static void main(String[] args) {
		test();
	}

	public static void test() {
		String projectPath = System.getProperty("user.dir");
		try {
			//driverName,url,username,password config in bee.properties.
			HoneyConfig honeyConfig = HoneyConfig.getHoneyConfig();
			honeyConfig.setUrl("jdbc:mysql://localhost:3306/lhl?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai");
			honeyConfig.setUsername("root");
			honeyConfig.setPassword("lhl123");
			honeyConfig.setDriverName("com.mysql.jdbc.Driver");


			GenConfig config = new GenConfig();
			config.setDbName("lhl");
			config.setGenToString(true);//生成toString方法
			config.setGenSerializable(true);

			//更改成本地的具体路径  change to your real path
			config.setBaseDir(projectPath + "/demo_bee/src/main/java");
			//config.setPackagePath("org.teasoft.exam.bee.osql.entity");
			config.setPackagePath("lhl.entity");

			//注释
			config.setGenComment(true);
			//数据库字段类
			config.setGenFieldFile(true);

			config.setCommentPlace(1);
			//设置相对Entity的文件夹; 空表示与Entity同一个文件夹 默认field
			config.setFieldFileRelativeFolder("field");
			//是否覆盖原来的文件
			//config.setOverride(true);

			GenBean genBean = new GenBean(config);
			genBean.genSomeBeanFile("table_test");

		} catch (BeeException e) {
			e.printStackTrace();
		}
	}
}
